<style type="text/css">.input-group-addon{min-width:96px;}</style>
<form action="{$action_url}" method="POST">
	<input type="hidden" name="__token__" value="{$Request.token}" />
	<input type="hidden" name="charge_type" value="{$Request.get.type}" />

	<div class="input-group mt10">
			<span class="input-group-addon" id="basic-addon1" style="border-right:1px solid #ccc;">套&nbsp;餐&nbsp;标&nbsp;准&nbsp;</span>
			{volist name="card_times_config" id="vo" key="k"}
			<label style="margin-right:10px;"><input type="radio" name="package" value="{$key}"> {$key}套餐</label>
			{/volist}
	</div>

	<div class="input-group mt10">
			<span class="input-group-addon" id="basic-addon1">会&nbsp;员&nbsp;帐&nbsp;号&nbsp;</span>
			<input type="number" name="mobile" value="{$mobile}" class="form-control" placeholder="会员/手机号" aria-describedby="basic-addon1">
	</div>

	<div class="input-group mt10">
		<span class="input-group-addon">办卡充值</label></span>
		<input type="number" class="form-control" name="recharge_money" value="" placeholder="充值金额">
	</div>

	<div class="input-group mt10">
		<span class="input-group-addon"><label><input type="checkbox" name="deduction">扣除余额</label></span>
		<input type="number" class="form-control" name="deduction_money" disabled value="{$account_recharge_money}" placeholder="扣除金额">
	</div>

	<h5>设置次数</h5>

	<div class="input-group mt10">
		<span class="input-group-addon" id="basic-addon1">DIY乐园</span>
		<input type="number" name="diy_times" class="form-control" value="0" placeholder="DIY次数" aria-describedby="basic-addon1">
	</div>
    <div class="input-group mt10">
		<span class="input-group-addon" id="basic-addon1">吃奶鱼</span>
		<input type="number" name="fish_times" class="form-control" value="0" placeholder="吃奶鱼次数" aria-describedby="basic-addon1">
	</div>
	<div class="input-group mt10">
		<span class="input-group-addon" id="basic-addon1">动物滚球</span>
		<input type="number" name="rollball_times" class="form-control" value="0" placeholder="动物滚球" aria-describedby="basic-addon1">
	</div>

	<div class="row">
		<button onclick="formSubmit(this)" type="button" class="btn btn-primary btn-block mt10">充值</button>
		<a href="{$detail_url}" class="btn btn-info btn-block mt10">不了，查看详情</a>
	</div>
   
</form>


<script>

function formSubmit(self) {
	var confirm_message = "充值金额："+$('input[name=recharge_money]').val()+"元\n";
		confirm_message += "DIY乐园："+$('input[name=diy_times]').val()+"次\n";
		confirm_message += "吃奶鱼："+$('input[name=fish_times]').val()+"次\n";
		confirm_message += " 动物滚球："+$('input[name=rollball_times]').val()+"次\n";

	if(!confirm(confirm_message))
		return ;
	$(self).parents('form').submit();
}


$(document).ready(function() {
	var times_config = {$card_times_config|json_encode};

	$('input[type=radio]').click(function() {
		var package_type = $(this).val();
		var config = times_config[package_type];

		if(config == undefined) {
			return ;
		}

		$('input[name=recharge_money]').val(package_type);

		$.each(config, function(k, v) {
			$('input[name='+k+']').val(v);
		});

	}).eq(0).click();

	$('input[name=deduction').click(function() {
		if($(this).is(':checked')) 
			$('input[name=deduction_money').attr('disabled', false);
		else 
			$('input[name=deduction_money').attr('disabled', true);
	});
});

</script>
